﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class 实验三_3_2_3_2_a : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            StudentClassesDataContext db = new StudentClassesDataContext();
            var stu = from x in db.Student
                      select x;

            foreach (var x in stu)
            {
                ListItem s = new ListItem();
                s.Text = x.name;
                s.Value = x.id;
                DropDownList1.Items.Add(s);
            }
        }


    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Write(DropDownList1.SelectedValue);
    }
}